<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>

    <script>

    </script>

</head>

<body>
<div>
    <ul class="nav nav-tabs">
        <li><a href="../dataTables/table">用户信息</a></li>
        <li class="active"><a href="">用户列表</a></li>
        <li><a href="../loginLog/list">登录日志</a></li>
        <li><a href="../loginOut">注销</a></li>
    </ul>
</div>

<div class="container" style="padding: 50px 30px 20px 30px">
    <form class="form-inline" id="pageForm" action="../user/list" method="post">
        <div class="row clearfix">
            <div class="col-md-10 column">
            </div>
            <div class="col-md-2 column" style="padding: 0px 0px 10px 10px">
                <button id="js-export2" type="button" class="btn-xs btn-primary">导出Excel</button>
            </div>
        </div>
        <div class="row clearfix">
            <div class="col-md-10 column">
                <div class="form-group has-success col-xs-6 col-sm-3" style="width: 130px">
                    <label for="username" class="sr-only control-label">姓名:</label>
                    <input type="text" name="username" id="username" class="form-control" placeholder="请输入姓名"
                           style="width: 100px">
                </div>

                <div class="form-group has-warning col-xs-6 col-sm-3" style="width: 100px">
                    <label for="gender" class="sr-only control-label">这是选择框:</label>
                    <select class="form-control" name="gender" id="gender">
                        <option value="">性别</option>
                        <option value="1">男</option>
                        <option value="0">女</option>
                    </select>
                </div>
                <div class="form-group has-warning col-xs-6 col-sm-3" style="width: 150px">
                    <div class="clearfix visible-xs"></div>
                    <button type="submit" class="btn btn-default btn-primary">查询</button>
                </div>
            </div>

            <div class="col-md-2 column">
                <button type="button" class="btn btn-default btn-success" onclick="location.href='./toAdd'">添加</button>
            </div>
        </div>
        <div class="row clearfix">
            <div class="col-md-2 column">
            </div>
            <div class="col-md-2 column">
            </div>
            <div class="col-md-4 column">
            </div>
            <div class="col-md-4 column">
            </div>
        </div>
        <div class="row clearfix" style="padding: 20px 30px 20px 0px">
            <div class="col-md-12 column">
                </table>
                <table class="table table-striped table-bordered table-hover text-center">
                    <thead>
                    <tr>
                        <th style="text-align: center">用户名</th>
                        <th style="text-align: center">性别</th>
                        <th style="text-align: center">年龄</th>
                        <th style="text-align: center">地区</th>
                        <th style="text-align: center">电话</th>
                        <th style="text-align: center">邮箱</th>
                        <th style="text-align: center">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <#if (listVar??)&&(listVar?size>0)>
                    <#list listVar as item>
                    <tr class="tr">
                        <td>${item.username}</td>
                        <td>
                            <#if (item.gender)?? && item.gender=="1">
                                男
                            <#elseif (item.gender)?? && item.gender=="0">
                                女
                            <#else>
                                未知
                            </#if>
                        </td>
                        <td>${(item.year)!}</td>
                        <td>${(item.areaName)!}</td>
                        <td>${(item.phone)!}</td>
                        <td>${(item.email)!}</td>
                        <td>
                            <button type="button" class="btn btn-default btn-warning btn-sm"
                                    onclick="location.href = './toUpdate/${item.userId}'">
                                修改
                            </button>
                            <button type="button" class="btn btn-default btn-danger btn-sm"
                                   onclick="location.href = './delUser/${(item.userId)!}'">
                                删除
                            </button>
                            <#-- data-toggle:加载绑定js内的实现类； data-target:绑定id -->
                            <button class="btn btn-default btn-danger btn-sm btn-primary"
                                    data-toggle="modal" data-target="#mymodal-data"
                                    type="button" >删除</button>
                            <#-- data-toggle:绑定js中的一些方法；data-target：与弹窗id绑定起来 -->
                        </td>
                    </tr>
                    </#list>
                    </#if>
                    </tbody>
                    <tfoot>
                    </tfoot>
                </table>

                <div>
                    <input type="hidden" id="pageSize" name="pageSize" value="">
                    <input type="hidden" id="currPage" name="currPage" value="">
                </div>

                <div class="pagger-box pagger" id="box">

                </div>

            </div>
        </div>
    </form>
</div>


<!-- 模态弹出窗内容 -->
<div class="modal" id="mymodal-data" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span
                        class="sr-only">Close</span></button>
                <h4 class="modal-title">模态弹出窗标题</h4>
            </div>

            <div class="modal-body">
                <p>您确定要删除此用户？</p>
            </div>

            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <#-- data-dismiss关闭某个元素 -->
                <button type="button" class="btn btn-primary" id="save" >删除</button>
            </div>
        </div>
    </div>
</div>
</body>

<script src="../js/require.js"></script>
<script src="../js/require.config.js"></script>
<script src="../js/templates/user/list.js"></script>

<script type="text/javascript">
    var gender = '${(user.gender)!}';
    var username = '${(user.username)!}';
    var totalCount = ${(page.totalCount)!};
    var currPage = ${(page.currPage)!};
    var pages =  ${(pages)!};
    var totalCount = ${(page.totalCount)!};
</script>

</html>